package cn.innosmart.aq.util;

import android.content.Context;
import android.os.Vibrator;

/**
 * Created by David on 2015/9/22.
 */
public class VibratorUtil {
    private static class VibratorUtilInstance {
        private static final VibratorUtil instance = new VibratorUtil();
    }

    public static VibratorUtil getInstance() {
        return VibratorUtilInstance.instance;
    }


    private VibratorUtil() {

    }


    public void vibrator(Context context,long[] pattern) {
        Vibrator vibrator = (Vibrator) context.getSystemService(Context.VIBRATOR_SERVICE);
        vibrator.vibrate(pattern, -1);           //重复两次上面的pattern 如果只
//        vibrator.cancel();
    }

    /**
     * 震动方法
     * @param context
     * @param milliseconds
     */
    public void vibrator(Context context, long milliseconds) {
        Vibrator vibrator = (Vibrator) context.getSystemService(Context.VIBRATOR_SERVICE);
        vibrator.vibrate(milliseconds);           //重复两次上面的pattern 如果只
//        vibrator.cancel();
    }
}
